package com.photoeditor.demo.model.subscribe.manager;

import android.support.annotation.IntDef;

import com.photoeditor.demo.model.bean.face.BaseFaceResultBean;
import com.photoeditor.demo.statistics.StatisticsConstant;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Created by Lai on 2018/10/24 0024.
 */
public class SVipConstant {

    public static final int VIP_ENTRANCE_IN_APP = 1;
    public static final int VIP_ENTRANCE_RETAIN = 2;
    public static final int VIP_ENTRANCE_FUNCTION_SUBSCRIBE= 3;
    public static final int VIP_ENTRANCE_SETTING = 4;
    public static final int VIP_ENTRANCE_EDIT= 5;
    public static final int VIP_ENTRANCE_ADVANCE_FEATURE = 6;
    public static final int VIP_ENTRANCE_PICTUREME_FORTUNE_YEAR = 105;
    public static final int VIP_ENTRANCE_PICTUREME_FORTUNE_MONTH = 106;
    public static final int VIP_ENTRANCE_PICTUREME_FORTUNE_WEEK = 107;



    public static final int VIP_ACTIVITY_A = 101;
    public static final int VIP_ACTIVITY_B = 102;

    public static final int VIP_FUTURE_A = 300;
    public static final int VIP_RETAIN_A = 400;

    public static final int VIP_DIALOG_A = 201;
    public static final int VIP_DIALOG_B = 202;

    public static final int COLOR_DARK = 1;
    public static final int COLOR_LIGHT = 0;


    public static final int REQUEST_CODE_FOR_VIP_ACTIVITY = 100;

    @IntDef({VIP_ENTRANCE_IN_APP, VIP_ENTRANCE_RETAIN,
            VIP_ENTRANCE_ADVANCE_FEATURE, VIP_ENTRANCE_SETTING, VIP_ENTRANCE_EDIT,VIP_ENTRANCE_FUNCTION_SUBSCRIBE})
    @Retention(RetentionPolicy.SOURCE)
    public @interface SVipEntrance {
    }

    @IntDef({VIP_ACTIVITY_A, VIP_ACTIVITY_B, VIP_RETAIN_A, VIP_FUTURE_A,COLOR_DARK})
    @Retention(RetentionPolicy.SOURCE)
    public @interface SVipPage {
    }

    public static boolean isABActivity(@SVipEntrance int page) {
        return !isABRetain(page) && page != VIP_ENTRANCE_ADVANCE_FEATURE;
    }

    public static boolean isFortuneEntrance(@SVipEntrance int page) {
        return page == VIP_ENTRANCE_PICTUREME_FORTUNE_YEAR
                || page == VIP_ENTRANCE_PICTUREME_FORTUNE_MONTH
                || page == VIP_ENTRANCE_PICTUREME_FORTUNE_WEEK;
    }

    public static boolean isABDialog(@SVipEntrance int page) {
        return page == VIP_ENTRANCE_ADVANCE_FEATURE;
    }


    public static boolean isABRetain(@SVipEntrance int page) {
        return page == VIP_ENTRANCE_RETAIN;
    }

    public static String getSPNameByEntrance(@SVipEntrance int entrance) {
        String string = StatisticsConstant.STATISTIC_EVENT_FUNC_VIP_VALUE_ENTRANCE_IN_APP_NEW;
        switch (entrance) {
            case VIP_ENTRANCE_IN_APP:
                string = StatisticsConstant.STATISTIC_EVENT_FUNC_VIP_VALUE_ENTRANCE_IN_APP_NEW;
                break;
            case VIP_ENTRANCE_SETTING:
                string = StatisticsConstant.STATISTIC_EVENT_FUNC_VIP_VALUE_ENTRANCE_SETTING;
                break;
            case VIP_ENTRANCE_RETAIN:
                string = StatisticsConstant.STATISTIC_EVENT_SUBSCRIBE_ENTRANCE_RETAIN;
                break;
            case VIP_ENTRANCE_EDIT:
                string = StatisticsConstant.STATISTIC_EVENT_SUBSCRIBE_ENTRANCE_EDIT;
                break;
            case VIP_ENTRANCE_ADVANCE_FEATURE:
                string = StatisticsConstant.STATISTIC_EVENT_SUBSCRIBE_ENTRANCE_HOW_OLD;
                break;
        }
        return string;
    }

    /**
     * @param funId @BaseFaceResultBean.REPORT_TYPE_
     * @return
     */
    public static String getAliasByFunType(int funId) {
        String ret = "";
        switch (funId) {
            case BaseFaceResultBean.REPORT_TYPE_FACE_AGING:
                ret = StatisticsConstant.STATISTIC_EVENT_VIP_VALUE_FACE_AGING;
                break;

            case BaseFaceResultBean.REPORT_TYPE_EXOTIC:
                ret = StatisticsConstant.STATISTIC_EVENT_VIP_VALUE_FACE_SWAP;
                break;
            case BaseFaceResultBean.REPORT_TYPE_GENDER_SWITCH:
                ret = StatisticsConstant.STATISTIC_EVENT_VIP_VALUE_GENDER_SWITCH;
                break;
            default:
                break;
        }
        return ret;
    }

}
